import config from 'config'
import httpFetch from 'share/httpFetch'
import errorMessage from 'share/errorMessage'

export default {

  //获取问题值列表项
  getIssueItems(params) {
    return new Promise((resolve, reject) => {
      httpFetch.get(`${config.baseUrl}/api/operation/enum/item/code`, params).then(res => {
        resolve(res)
      }).catch(e => {
        errorMessage(e.response);
        reject(e)
      })
    })
  },

  //创建反馈
  createFeedback(params) {
    return new Promise((resolve, reject) => {
      httpFetch.post(`${config.baseUrl}/api/operation/feedback`, params).then(res => {
        resolve(res)
      }).catch(e => {
        errorMessage(e.response);
        reject(e)
      })
    })
  },

  //上传图片
  uploadImage(params) {
    return new Promise((resolve, reject) => {
      httpFetch.post(`${config.baseUrl}/api/upload/static/attachment/attachment/v3?attachmentType=CARROUSEL_IMAGES`, params).then(res => {
        resolve(res)
      }).catch(e => {
        errorMessage(e.response);
        reject(e)
      })
    })
  },

}
